package com.shopping.common;

public enum ResultCode {
    success("成功", 1) {
        @Override
        public ResultCode expend(String message) {
            this.setMessage(this.getCode() + "," + message);
            return this;
        }
    }, failure("失败", 0) {
        @Override
        public ResultCode expend(String message) {
            this.setMessage(this.getCode() + "," + message);
            return this;
        }
    }, paramLost("请求参数不全", 2) {
        @Override
        public ResultCode expend(String otherInfo) {
            this.setMessage(this.getCode() + "," + otherInfo);
            return this;
        }
    };


    private int code;
    private String message;

    ResultCode(String message, int code) {
        this.message = message;
        this.code = code;
    }

    public int getCode() {
        return code;
    }

    public void setCode(int code) {
        this.code = code;
    }

    public String getMessage() {
        return message;
    }

    public void setMessage(String message) {
        this.message = message;
    }

    public ResultCode expend(String otherInfo) {
        throw new AbstractMethodError();
    }

}
